<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$app->get('/', function () use ($app) {
    return view('mobile');
});

$app->get('admin/index', 'AdminController@index');

//管理后台接口
$app->group(['middleware' => ['auth']], function () use ($app) {


    //image
    $app->post('image/upload', 'ImageController@upload');
    $app->post('image/save', 'ImageController@addImage');
    $app->post('image/grouping', 'ImageController@updImgGroup');
    $app->get('image/list', 'ImageController@lists');
    $app->get('image/delete', 'ImageController@delImage');
    $app->post('image/addGroup', 'ImageController@addGroup');
    $app->get('image/groupList', 'ImageController@groupList');
    $app->get('image/deleteGroup', 'ImageController@deleteGroup');

    //banner
    $app->post('banner/save', 'BannerController@save');
    $app->post('banner/update', 'BannerController@update');
    $app->get('banner/list', 'BannerController@lists');
    $app->get('banner/test', 'BannerController@test');
    $app->get('banner/list', 'BannerController@lists');

    //nav
    $app->post('nav/save', 'NavController@save');
    $app->post('nav/update', 'NavController@update');
    $app->get('nav/delete', 'NavController@delete');
    $app->get('nav/list', 'NavController@lists');

    //indexNav
    $app->post('indexNav/save', 'IndexNavController@save');
    $app->post('indexNav/update', 'IndexNavController@update');
    $app->get('indexNav/delete', 'IndexNavController@delete');
    $app->get('indexNav/list', 'IndexNavController@lists');


    //products
    $app->post('products/save', 'ProductsController@save');
    $app->post('products/update', 'ProductsController@update');
    $app->get('products/delete', 'ProductsController@delete');
    $app->get('products/list', 'ProductsController@lists');
    $app->get('products/info', 'ProductsController@info');


    //articles
    $app->post('articles/save', 'ArticlesController@save');
    $app->post('articles/update', 'ArticlesController@update');
    $app->get('articles/delete', 'ArticlesController@delete');
    $app->get('articles/list', 'ArticlesController@lists');
    $app->get('articles/info', 'ArticlesController@info'); //文章详情

    $app->post('articles/grouping', 'ArticlesController@grouping');
    $app->post('articles/addGroup', 'ArticlesController@addGroup');
    $app->get('articles/groupList', 'ArticlesController@groupList');
    $app->get('articles/deleteGroup', 'ArticlesController@deleteGroup');


    //statistics log
    $app->post('statistics/save', 'StatisticsController@save');
    $app->post('statistics/jump', 'StatisticsController@addThirdJump');
    $app->get('statistics/list', 'StatisticsController@lists');

    //advert
    $app->post('advert/save', 'AdvertController@save');
    $app->post('advert/update', 'AdvertController@update');
    $app->get('advert/delete', 'AdvertController@delete');
    $app->get('advert/list', 'AdvertController@lists');

    //cards
    $app->post('card/save', 'CardController@save');
    $app->post('card/update', 'CardController@update');
    $app->get('card/delete', 'CardController@delete');
    $app->get('card/list', 'CardController@lists');
    $app->get('card/info', 'CardController@info');

    //user
    $app->get('user/list', 'UserController@lists');


    //website
    $app->post('website/update', 'WebsiteController@update');
    $app->get('website/info', 'WebsiteController@info');

    $app->post('imageText/save', 'ImageTextController@save');
    $app->post('imageText/update', 'ImageTextController@update');
    $app->get('imageText/delete', 'ImageTextController@delete');
    $app->get('imageText/list', 'ImageTextController@lists');
    $app->get('imageText/info', 'ImageTextController@info');
    $app->post('imageText/grouping', 'ImageTextController@updImgTextGroup');
    $app->post('imageText/addGroup', 'ImageTextController@addGroup');
    $app->get('imageText/deleteGroup', 'ImageTextController@deleteGroup');
    $app->get('imageText/groupLists', 'ImageTextController@groupLists');

    //my
    $app->post('my/update', 'MyController@update');
    $app->get('my/list', 'MyController@lists');


    $app->post('admin/save', 'AdminController@add');
    $app->get('admin/list', 'AdminController@lists');

});

/******* 前端接口 *******/


//nav
$app->get('m/nav/list', 'NavController@mobileLists');
$app->get('m/indexNav/list', 'IndexNavController@mobileLists');

//banner
$app->get('m/banner/list', 'BannerController@mobileLists');

//article
$app->get('m/articles/list', 'ArticlesController@mobileLists');
$app->get('m/articles/info', 'ArticlesController@mobileInfo'); //文章详情

$app->get('m/products/list', 'ProductsController@mobileLists');
$app->get('m/products/info', 'ProductsController@mobileInfo');

$app->get('m/advert/list', 'AdvertController@mobileLists');

$app->get('m/card/list', 'CardController@mobileLists');
$app->get('m/card/info', 'CardController@mobileInfo');

$app->get('m/website/info', 'WebsiteController@mobileInfo');

$app->get('m/imageText/list', 'ImageTextController@mobileLists');
$app->get('m/imageText/info', 'ImageTextController@mobileInfo');

//my
$app->get('m/my/list', 'MyController@mobileLists');


//移动端登陆注册接口
$app->post('user/register', 'UserController@register');
$app->post('m/user/login', 'UserController@login');

//短信接口
$app->get('m/user/sendCode', 'UserController@sendCode');


//后台登陆接口
$app->post('admin/login', 'AdminController@login');

$app->get('m/user/checkToken', 'UserController@checkToken');

//移动端接口
$app->group(['middleware' => ['authMobile']], function () use ($app) {

});